projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2feac27
)
layoutoverlay: Avoid adding transparent color nodes
author
Timm Bäder
<mail@baedert.org>
Mon, 21 Dec 2020 07:34:25 +0000
(08:34 +0100)
committer
Timm Bäder
<mail@baedert.org>
Mon, 21 Dec 2020 09:26:03 +0000
(10:26 +0100)
We have a region for the border here, but the color is defined as
transparent black because we don't want to render anything for it.
This way, the generated .node file for the listbox demo in gtk4-demo
with enabled layout borders is 3.5MB instead of 3.8MB.
gtk/inspector/layoutoverlay.c
patch
|
blob
|
history
diff --git
a/gtk/inspector/layoutoverlay.c
b/gtk/inspector/layoutoverlay.c
index 3924f03bb8f83d398d55a460173b34963492a761..a72a40940ee03a8060ae029f3a496168176173af 100644
(file)
--- a/
gtk/inspector/layoutoverlay.c
+++ b/
gtk/inspector/layoutoverlay.c
@@
-107,6
+107,9
@@
recurse_child_widgets (GtkWidget *widget,
const GdkRGBA *color = &colors[i];
const GtkBorder *box = &boxes[i];
+ if (gdk_rgba_is_clear (color))
+ goto next;
+
if (box->top > 0)
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT ( 0, - box->top, width, box->top));
@@
-120,6
+123,7
@@
recurse_child_widgets (GtkWidget *widget,
gtk_snapshot_append_color (snapshot, color,
&GRAPHENE_RECT_INIT (- box->left, 0, box->left, height));
+next:
/* Grow box + offset */
width += box->left + box->right;
height += box->top + box->bottom;